package com.ylkj.member.dao.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.ylkj.common.base.BaseDaoHibernate;
import com.ylkj.common.entity.LawyerInfo;
import com.ylkj.member.dao.LawyerInfoDAO;

@Repository
public class LawyerInfoDAOImpl extends BaseDaoHibernate implements LawyerInfoDAO {

	@SuppressWarnings("unchecked")
	@Override
	public List<LawyerInfo> queryLawyerInfoByPara(Map<String, Object> para) {
		List<String> paras = new ArrayList<String>();
		List<Object> values = new ArrayList<Object>();
		
		StringBuffer sb = new StringBuffer("from LawyerInfo where 1=1");
		
//		if (para.get("contractId") != null && !para.get("contractId").equals("")) {
//			sb.append(" and contractId=:contractId");
//			paras.add("contractId");
//			values.add(para.get("contractId"));
//		}
		
		return getHibernateTemplate().findByNamedParam(sb.toString(), paras.toArray(new String[paras.size()]), values.toArray());
	}

	@Override
	public void addLawyerInfo(LawyerInfo lawyerInfo) {
		this.getHibernateTemplate().save(lawyerInfo);
	}

	@Override
	public void updateLawyerInfo(LawyerInfo lawyerInfo) {
		this.getHibernateTemplate().update(lawyerInfo);
	}

	@Override
	public void delLawyerInfo(LawyerInfo lawyerInfo) {
		this.getHibernateTemplate().delete(lawyerInfo);
	}

}
